<template>
  <div class="list">
    <div class="section">
      <el-form size="small" :inline="true" :model="whereData" class="search-from">
        <el-form-item>
          <el-input @keyup.enter.native="fetchData()" clearable v-model="whereData.batch_no" placeholder="批次号"></el-input>
        </el-form-item>
        <el-form-item>
          <el-select @change="fetchData" v-model="whereData.status_audit">
            <el-option label="待审核" value="待审核"></el-option>
            <el-option label="审核驳回" value="审核驳回"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-date-picker
            style="width: 260px"
            v-model="daterange"
            type="daterange"
            @change="handleDateChange"
            value-format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="fetchData()">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="section">
      <el-table
        :data="tableData"
        @sort-change="sortList"
        v-loading="isLoading"
        style="width: 100%">
        <el-table-column
          align="center"
          prop="id"
          sortable="custom"
          label="ID">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="patch_no"
          label="批次号">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="money_count"
          label="笔数">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="time_add"
          :formatter="formatTime"
          label="导入时间">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="action_role"
          label="导入类型">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="money_income"
          label="支付总额">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="money_pay"
          label="实付总额">
        </el-table-column>
        <!-- <el-table-column
          align="center"
          show-overflow-tooltip
          prop="address"
          label="支付方式">
        </el-table-column> -->
        <el-table-column
          sortable="custom"
          align="center"
          show-overflow-tooltip
          prop="status_audit"
          label="审核状态">
        </el-table-column>
        <el-table-column
          align="center"
          sortable="custom"
          show-overflow-tooltip
          prop="audit_errmsg"
          label="驳回原因">
        </el-table-column>
        <el-table-column
          align="center"
          show-overflow-tooltip
          prop="address"
          label="操作">
          <template slot-scope="scope">
            <el-button @click="goDetail(scope.row)" size="mini" type="primary">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page.sync="pageIndex"
        :page-size="pageSize"
        layout="total, prev, pager, next, jumper"
        :total="totalCount">
      </el-pagination>
    </div>
  </div>
</template>
<script>
import tableMixin from '@/common/mixins/tableData'
export default {
  name: 'list',
  mixins: [tableMixin],
  data() {
    return {
      listApi: '/company/money/settle/get',
      whereData: {
        batch_no: '',
        status_audit: '待审核'
      },
      daterange: ''
    }
  },
  methods: {
    goDetail(row) {
      this.$router.push('/company/deal/settlement/detail?id=' + row.id)
    }
  }
}
</script>